<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>分配学生</title>
</head>
<body>
<h1 th:text="'教师: ' + ${teacher.name}"></h1>

<h2>已分配学生</h2>
<table border="1">
    <tr><th>姓名</th><th>Java成绩</th><th>头像</th></tr>
    <tr th:each="student : ${assignedStudents}">
        <td th:text="${student.name}"></td>
        <td th:text="${student.javaScore}"></td>
        <td><img th:if="${student.photo}" th:src="${student.photo}" style="width:100px"></td>
    </tr>
</table>

<h2>未分配学生</h2>
<table border="1">
    <tr><th>姓名</th><th>Java成绩</th><th>头像</th><th>操作</th></tr>
    <tr th:each="student : ${unassignedStudents}">
        <td th:text="${student.name}"></td>
        <td th:text="${student.javaScore}"></td>
        <td><img th:if="${student.photo}" th:src="${student.photo}" style="width:100px"></td>
        <td>
            <a th:href="@{/assignStudent(studentId=${student.id},teacherId=${teacher.id})}">分配</a>
            <a th:href="@{/uploadPhoto(id=${student.id},teacherId=${teacher.id})}">上传头像</a>
        </td>
    </tr>
</table>
<a href="/">返回首页</a>
</body>
</html>